import { hasClass, addClass } from "@/utils";

export default function animate(el, binding) {
  if (!hasClass(el, `animate__${binding.value.name}`)) {
    !hasClass(el, "animate__animated") && addClass(el, "animate__animated");
    binding.value.delay && el.style.setProperty("animation-delay", `${binding.value.delay}ms`)
    binding.value.duration && el.style.setProperty('--animate-duration', `${binding.value.duration}ms`)
    binding.value.infinite &&  addClass(el, "animate__infinite")
    addClass(el, `animate__${binding.value.name}`);
  }
}
